@import 'group';
@import '../../../styles/var';

@radio: ~'@{prefix}-radio';

.@{radio} {
  cursor: pointer;
  line-height: 20px;
  display: inline-block;
  vertical-align: top;
  font-size: 12px;
  font-family: @font-family;
  color: @font-color;

  &.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  &:hover:not(.is-disabled) {
    .@{radio}-input {
      border: 1px solid @primary-color;
    }
  }

  &.is-checked {
    .@{radio}-input {
      border: 1px solid @primary-color;
    }

    .@{radio}-input:after {
      opacity: 1;
      transform: scale(1);
    }
  }

  &:not(.is-disabled) {
    .@{radio}-input {
      &:focus {
        border: 1px solid @primary-color;
        box-shadow: @focus-shadow-primary-light;
      }
    }
  }
}

.@{radio}-input {
  display: inline-block;
  vertical-align: top;
  width: 14px;
  height: 14px;
  margin: 8px 0;
  border: 1px solid @border-color;
  box-sizing: border-box;
  border-radius: 50%;
  background-color: @component-background;

  &:focus {
    outline: none;
  }

  &:after {
    content: '';
    display: block;
    opacity: 0;
    width: 8px;
    height: 8px;
    transform: scale(0);
    transition: transform @fast-motion @ease-in-out-circular;
    background-color: @primary-color;
    border-radius: 50%;
    margin: 2px;
  }
}

.@{radio}-label {
  display: inline-block;
  vertical-align: top;
  padding: 5px;

  &:empty {
    display: none;
  }
}
